package threads;

class Hello {
	void show() {
		Thread th = Thread.currentThread();
		for (int i = 0; i < 5; i++) {
			System.out.println("show() method:" + i + "\t" + th.getName() + "\t" + this);

		}
	}
}

class HelloThread extends Thread {
	Hello h = null;

	HelloThread(Hello h) {
		this.h = h;
	}

	public void run() {
		h.show();
	}
}

class ThTest2 {
	public static void main(String args[]) {
		Hello h = new Hello();
		HelloThread th1 = new HelloThread(h);
		HelloThread th2 = new HelloThread(h);
		th1.run();
		th2.run();
		System.out.println("------------------");
		th1.start();
		th2.start();
	}
}
